{% extends "tasks/base.html" %}

{% load i18n %}
{% load account_tags %}
{% load tasks_tags %}
{% load comments_tag %}
{% load uni_form_tags %}
{% load attachments_tags %}
{% load group_tags %}
{% load theme_tags %}

{% block head_title %}{{ task.summary }}{% endblock %}
{% block extra_head %}{{form.media}}{% endblock %}

{% block body %}
    {#<p><a href="{% url project_tasks task.project.slug %}">&larr; {% trans "Back to Task List for Project " %} {{ task.project }}</a></p>#}
    
    <p><a href="{% groupurl tasks_today group username=user.username %}">&larr; {% trans "Today's tasklist" %}</a></p>
    
    {% if is_member %}
        <h2>{% trans "Edit" %}</h2>
        <form method="POST" action="" id="task_form" class="uniForm">
            {% csrf_token %}
            {{ form.media }}
            {{ form|as_uni_form }}
            
            <div class="form_block">
                <input type="submit" value="{% trans "Update Task" %}" />
            </div>
            
        </form>
    {% endif %}
    
    {% get_attachments_for task as "attachments" %}
    {% if attachments %}
    <h2>{% trans "Attachments" %}</h2>
    
    <ul>
    {% for attachment in attachments %}
        <li>
            {% silk "attach" %}
            <a href="{{ attachment.attachment_file.url }}">{{ attachment.filename }}</a>
            - <span class="lighter">{{ attachment.created|date:_("DATETIME_FORMAT") }}</span>
            {% attachment_delete_link attachment %}
        </li>
    {% endfor %}
    </ul>
    {% endif %}
    
    {% attachment_form task %}
    
    <h2>{% trans "Comment" %}</h2>
    {% comments task %}
{% endblock %}

{% block extra_body %}
<script src="/static/js/jquery-ui-1.8.7.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $().ready(function() {
        $('#id_assignee').after(' <a href="#" onclick="$(\'#id_assignee\').val({{ user.id }}); return false;">{% trans "assign to me" %}</a>');
    });
    
    $('#nudge-history-target').hide();
    $('#nudge-history').click(function() {
        $('#nudge-history-target').toggle();
    });
</script>
<script type="text/javascript">
    $().ready(function() {
        $(".jqueryuidatepickerwidget").each(function (i) {
            $(this).datepicker({dateFormat:"yy-mm-dd"});
        });
        
    });
</script>
{% endblock %}
